using System;
using System.Collections.Generic;
using System.Text;
using DTO;
using DAO;
using System.Data;

namespace BUS
{
    /// <summary> 
    ///Author: nnamthach@gmail.com 
    /// <summary>
    public class Test_Log_AnswerControl
    {
        #region Local Variable
        private Test_Log_AnswerDataAccess _objDAO;
        #endregion Local Variable

        #region Method
        public Test_Log_AnswerControl()
        {
            _objDAO = new Test_Log_AnswerDataAccess();
        }

        public Test_Log_AnswerInfo Get(
        Int32 Test_Log_No,
        Int32 Test_Log_Line,
        Int64 Answer_ID,
        ref string sErr)
        {
            return _objDAO.Get(
            Test_Log_No,
            Test_Log_Line,
            Answer_ID,
            ref sErr);
        }

        public DataTable Get_Selected(
       Int32 Test_Log_No,
       Int32 Test_Log_Line,

       ref string sErr)
        {
            return _objDAO.Get_Selected(
           Test_Log_No,
           Test_Log_Line,

           ref sErr);
        }

        public DataTable GetAll(
        ref string sErr)
        {
            return _objDAO.GetAll(
            ref sErr);
        }

        public Int32 Add(Test_Log_AnswerInfo obj, ref string sErr)
        {
            return _objDAO.Add(obj, ref sErr);
        }

        public string Update(Test_Log_AnswerInfo obj)
        {
            return _objDAO.Update(obj);
        }

        public string Delete(
        Int32 Test_Log_No,
        Int32 Test_Log_Line,
        Int64 Answer_ID
        )
        {
            return _objDAO.Delete(
            Test_Log_No,
            Test_Log_Line,
            Answer_ID
            );
        }
        public Boolean IsExist(
        Int32 Test_Log_No,
        Int32 Test_Log_Line,
        Int64 Answer_ID
        )
        {
            return _objDAO.IsExist(
            Test_Log_No,
            Test_Log_Line,
            Answer_ID
            );
        }

        public DataTableCollection Get_Page(Test_Log_AnswerInfo obj, string orderBy, int pageIndex, int pageSize, ref String sErr)
        {
            return _objDAO.Get_Page(obj, orderBy, pageIndex, pageSize, ref sErr);
        }

        public DataTable Search(String columnName, String columnValue, String condition, ref String sErr)
        {
            return _objDAO.Search(columnName, columnValue, condition, "", ref  sErr);
        }
        public string InsertUpdate(Test_Log_AnswerInfo obj)
        {
            string sErr = "";
            if (IsExist(
            obj.Test_Log_No,
            obj.Test_Log_Line,
            obj.Answer_ID
            ))
            {
                sErr = Update(obj);
            }
            else
                Add(obj, ref sErr);
            return sErr;
        }

        public DataTable GetTransferOut(string dtb, object from, object to, ref string sErr)
        {
            return _objDAO.GetTransferOut(dtb, from, to, ref sErr);
        }

        public DataTable ToTransferInStruct()
        {
            Test_Log_AnswerInfo inf = new Test_Log_AnswerInfo();
            return inf.ToDataTable();
        }

        public string TransferIn(DataRow row)
        {
            Test_Log_AnswerInfo inf = new Test_Log_AnswerInfo(row);
            return InsertUpdate(inf);
        }
        #endregion Method


        public string Delete_TestNo(int maxNo)
        {
            return _objDAO.Delete_TestNo(maxNo);
        }

        public DataTable GetLogByIDTest(long p)
        {
            throw new NotImplementedException();
        }

        public DataTable GetLogByNo(long No, ref string sErr)
        {
            return _objDAO.GetLogByNo(No, ref  sErr);
        }



        public DataTable GetLogByNoScore(int no, double score, ref string sErr)
        {
            return _objDAO.GetLogByNoScore(no, score, ref sErr);
        }
    }
}
